$(function(){	
	$(".replyBtn").click(function(){
		if($(this).attr("data-check")=="true"){
			$(this).attr("data-check","false");
			var str = '<textarea class="commentCont" name="content"></textarea>'+
				'<button class="responseButton responseDisable" disabled>回覆</button>';
			$(this).closest("span").after(str);
		}
	});
	$("#commentArea").on("keyup",".commentCont",function(){
		var element = $(this).next("button");
		if($(this).val()!=""){
			element.attr("disabled",false);
			element.removeClass("responseDisable");
		}
		else{
			element.attr("disabled",true);
			element.addClass("responseDisable");
		}
	});
	$("#commentArea").on("click",".responseButton",function(){
		$("#topID").val($(this).closest("p").find(".replyBtn").attr("data-id"));
		$("#content").val($(this).prev("textarea").val());
		$("#replyForm").submit();
	});
});